#include<bits/stdc++.h>

using namespace std;
int a[101][101], book[101][101], n, m;
int sx, sy;//源点坐标
int tot = 0;
int fx[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};//四连通 顺时针方向
void dfs(int x, int y) {
    if (book[x][y] == 1 || a[x][y] == 0)return;
    if (a[x][y] >= 1)++tot;
    book[x][y] = 1;
    for (int i = 0; i < 4; i++) {
        int nx = x + fx[i][0];//相邻的四连通点的x新坐标
        int ny = y + fx[i][1];//相邻的四连通点的y新坐标
        if (nx < 0 || nx >= n || ny < 0 || ny >= m)continue; //检查位置的有效性
        if (a[nx][ny] == 0 || book[nx][ny] == 1)continue;//避免重复访问
        dfs(nx, ny);
    }
}

int main() {
    while (cin >> n >> m >> sx >> sy) {

        for (int i = 0; i < n; i++)
            for (int j = 0; j < m; j++)
                cin >> a[i][j];
        memset(book, 0, sizeof(book));
        tot = 0;
        dfs(sx - 1, sy - 1);
        cout << tot << endl;
    }
    return 0;
}